package org.hit.burkun.mapping;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BlockOnlineMapping extends BasicOnlineMappingProcessor {

	private Map<String, Set<String>> resMap;
	private static Logger logger = LoggerFactory
			.getLogger(BasicOfflineMapping.class);

	public BlockOnlineMapping(int retryTimes, boolean useDbCache) {
		super(retryTimes, useDbCache);
		resMap = new HashMap<String, Set<String>>();
	}

	@Override
	public void mapping(DBKEY fromKey, DBKEY toKey, Collection<String> data) {
		resMap.clear();
		super.mapping(fromKey, toKey, data);
	};

	@Override
	public void process(DBKEY fromKey, DBKEY toKey,
			Map<String, Set<String>> resData) {
		super.process(fromKey, toKey, resData);
		logger.debug("add return res to mapping dictory!");
		resMap.putAll(resData);
	}

	public Map<String, Set<String>> getResult() {
		return resMap;
	}
}
